﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;

namespace TrenchcoatRobots.Datatypes.Input {
	/// <summary>
	/// This is the class for simple KeyboardInput. Nothing fancy here at all
	/// </summary>
	public class KeyboardInput : GameInput {
		public Keys PositiveKey { get; set; }
		public Keys NegativeKey { get; set; }
		bool useNegative;

		public override void Update( ref KeyboardState ks ) {
			base.Value = 0;
			if ( ks.IsKeyDown( PositiveKey ) ) {
				base.Value += 1;
			}
			if ( useNegative ) {
				if ( ks.IsKeyDown( NegativeKey ) ) {
					base.Value -= 1;
				}
			}
		}

		public KeyboardInput( Keys positiveKey, string name )
			: base( name ) {
			PositiveKey = positiveKey;
			useNegative = false;
		}
		public KeyboardInput( Keys positiveKey, Keys negativeKey, string name )
			: base( name ) {
			PositiveKey = positiveKey;
			NegativeKey = negativeKey;
			useNegative = true;
		}
	}
}
